<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //  ['1', '3', '5', '3', '5', '3', '8', '9'] 统计次数 次数最大的次数是谁
        let arr = ['1', '3', '5', '3', '5', '3', '8', '9']
        let arr1 = []
        let obj = {}
        arr.forEach(item => {
            if (arr1.indexOf(item) === -1) {
                arr1.push(item)
                obj[item] = 1
            } else {
                obj[item]++
            }
        });
        console.log(obj);
        let max = 0
        let maxnum = ''
        for (const k in obj) {
            if (obj[k] > max) {
                max = obj[k]
                maxnum = k
            }
        }
        console.log(maxnum);
    </script>
</body>

</html>